#include <stdio.h>

int main(void) {
	int num;
	scanf("%d", &num);
	int arr[500];
	int i = 0;
	arr[i] = num;
	while (num != 1) {
		if (num % 2 == 1) {
			num *= 3;
			num += 1;
			i++;
			arr[i] = num;
		} else {
			num /= 2;
			i++;
			arr[i] = num;
		}
	}
	for (int j = i; j >= 0; j--) {
		printf("%d ", arr[j]);
	}
	return 0;
}